package com.ag.hmk.service.impl;

import java.util.List;

import com.ag.hmk.dao.HmkUiltDAO;
import com.ag.hmk.service.HmkUiltService;

public class HmkUiltServImpl implements HmkUiltService {

	

	private HmkUiltDAO hmkUiltDAO;
	
	/*
	 * sql更新
	 */
	@Override
	public void queryUpdate(String sql) {
		hmkUiltDAO.queryUpdate(sql);
	}
	
	/*
	 *hql查询
	 */
	@Override
	public List hqlQuery(String hql) {
		List list =null;
		try {
			list = hmkUiltDAO.hqlQuery(hql);
		} catch (Exception e) {
			e.printStackTrace();
		}
		return list;
	}

	
	/*
	 *hql分页查询
	 */
	public List query(String hql, int firstROW, int maxROW) {
		List list =null;
		try {
			System.out.println("==================== hmkUiltDAO.query");
			list = hmkUiltDAO.queryList(hql, firstROW, maxROW);
		} catch (Exception e) {
			e.printStackTrace();
			System.out.println("==================== hmkUiltDAO.queryList(hql, firstROW, maxROW);===================");
		}
		System.out.println("========bbbbbb");
		return list; 
	}

	/*
	 *hql查询记录条数
	 */
	public int getCount(String hql) {
		int count=0;
		try {
			count =((Long) hmkUiltDAO.queryCount(hql).iterator().next()).intValue();
		} catch (Exception e) {
			e.printStackTrace();
		}	
		return count;
	}

	public void setHmkUiltDAO(HmkUiltDAO hmkUiltDAO) {
		this.hmkUiltDAO = hmkUiltDAO;
	}

}
